from xpinyin import Pinyin

b = input("请输入存放文件路径：") + "/"
c1 = input("源文件名：")
c2 = input("新文件名：")

before = open(b + c1 + ".txt", "r", encoding='utf-8')
str = before.read()
p = Pinyin()
after = p.get_pinyin(str, ' ')
f = open(b + c2 + ".txt", "w", encoding='utf-8')
f.write(after)
f.close()
before.close()